﻿<!doctype html>
 <html >
 <head>
   <meta charset="UTF-8">
   <link rel="stylesheet" href="${req.contextPath}/css/common.css">
   <link rel="stylesheet" href="${req.contextPath}/css/main.css">
   <script type="text/javascript" src="${req.contextPath}/js/jquery.min.js"></script>
   <script type="text/javascript" src="${req.contextPath}/js/colResizable-1.3.min.js"></script>
   <script type="text/javascript" src="${req.contextPath}/js/common.js"></script>
</head>

<body>
  <div id="forms" class="mt10">
        <div class="box">
          <div class="box_border">
            <div class="box_top"><b class="pl15">添加车辆</b></div>
            <div class="box_center">
              <form id="form" action="list.ftl" class="jqtransform">
               <table class="form_table pt15 pb15" width="100%" border="0" cellpadding="0" cellspacing="0">

                   <input type="hidden" name="carId" class="input-text lh30" size="40" value="${car.carId}">
                   <input type="hidden" id="page" name="page" class="input-text lh30" size="40" value="${page}">
                   <tr>
                  <td class="td_right">车牌号：</td>
                  <td class=""> 
                    <input type="text" id="numCar" name="numCard" class="input-text lh30" size="40" value="${car.numCard}">
                  </td>
				  </tr>
				  <tr>
                  <td class="td_right">车型：</td>
				  <td><input type="text" name="vehicleType" class="input-text lh30" size="40" value="${car.vehicleType}"></td>
                </tr>
				<tr>
                  <td class="td_right">颜色：</td>
				  <td><input type="text" name="vehicleColor" class="input-text lh30" size="40" value="${car.vehicleColor}"></td>
                </tr>
				<tr>
                  <td class="td_right">备注：</td>
				  <td><textarea class="input-text lh30" name="content" placeholder="选填" >${car.content}</textarea></td>
                </tr>
                 <tr>
                   <td class="td_right">&nbsp;</td>
                   <td class="">
                     <input type="button" onclick="update()" name="button" class="btn btn82 btn_save2" value="保存">
                    <input type="button" name="button" class="btn btn82 btn_res" onclick="location.href='javascript:history.go(-1)'" value="返回"> 
                   </td>
                 </tr>
               </table>
               </form>
            </div>
          </div>
        </div>
     </div>
   </div> 
</body>

 <script type="text/javascript" src="${req.contextPath}/js/jquery.min.js"></script>
 <script>
    function update() {
        // var num=$("#numCar").val();
        // alert(num)
        //校验车牌号
        if (!(/^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-Z0-9]{4}[A-Z0-9挂学警港澳]{1}$/.test($("#numCar").val()))){
            alert("车牌号不合法")
            return;
        }else {
            var formDate = $("#form").serialize();
            var page = $("#page").val();
            $.post(
                "${req.contextPath}/administrative/updateCar",
                formDate,
                function (result) {
                    if (result.code == 0) {
                        alert("修改成功");
                        location.href = "${req.contextPath}/resource/xingzheng/demo2/list?page=" + page;
                    } else {
                        alert(result.msg)
                    }
                },
                "json"
            );
        }
    }


 </script>


</html>